﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace pinduoduo
{
    public class IPProxy
    {
        public static string GetNewIp() 
        {
            //string url = "http://piping.mogumiao.com/proxy/api/get_ip_bs?appKey=6100573b507b479fb6a876838df1773b&count=1&expiryDate=0&format=2&newLine=2";
            //string url = "http://api.xdaili.cn/xdaili-api//greatRecharge/getGreatIp?spiderId=aa5be97fac2443db8fd2fcca58dc711d&orderno=YZ20213135457z2dgYq&returnType=1&count=1";
            string url = "  http://tiqu.linksocket.com:81/abroad?num=1&type=1&lb=1&sb=0&flow=1&regions=china&port=1&n=1";

            using (var client = new HttpClient())
            {
                //请求结果
                string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
                Console.WriteLine(result);
                return result;
            }
        }

        public static string GetProxyIp(string url)
        {
            using (var client = new HttpClient())
            {
                string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
                if (!string.IsNullOrWhiteSpace(result))
                {
                    result = result.Replace("\0", "").Replace("\r\n", "");
                }
                return result;
            }
        }

        public static string GetZMNewIp()
        {
            string url = "http://changming1.feidudaili.com:10000/index/api/get_data?p=eyJtb2RlIjoiaHR0cCIsImNvdW50IjoiMSIsImJfdGltZSI6IjUwIiwiZGF0YV90eXBlIjoiMSIsImxpbmVfYnJlYWsiOiI2IiwiYmFsYW5jZSI6IjAiLCJzZWNlcnQiOiJNVFUxTVRNeU1qa3lOREk2TURBNE1HWTJZVFJtTldNNVptRm1NekEzTWpFNVpUZGxPRGcxTldGbE1UWT0ifQ==";
            using (var client = new HttpClient())
            {
                //请求结果
                string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
                Console.WriteLine(result);
                return result;
            }
        }

        public static string GetZMNewIp(string url)
        {
            //string url = "http://changming1.feidudaili.com:10000/index/api/get_data?p=eyJtb2RlIjoiaHR0cCIsImNvdW50IjoiMSIsImJfdGltZSI6IjUwIiwiZGF0YV90eXBlIjoiMSIsImxpbmVfYnJlYWsiOiI2IiwiYmFsYW5jZSI6IjAiLCJzZWNlcnQiOiJNVFUxTVRNeU1qa3lOREk2TURBNE1HWTJZVFJtTldNNVptRm1NekEzTWpFNVpUZGxPRGcxTldGbE1UWT0ifQ==";
            using (var client = new HttpClient())
            {
                //请求结果
                string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
                Console.WriteLine(result);
                return result;
            }
        }
        // http://http.tiqu.letecs.com/getip3?num=1&type=1&pro=&city=0&yys=0&port=1&time=1&ts=0&ys=0&cs=0&lb=1&sb=0&pb=4&mr=1&regions=&gm=4

    }
}
